﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PhoneUI.Com.Modle
{
    public class BaseAnnex
    {
        // 主键
        public int fileID { get; set; }
        // 文件名
        public string fileName { get; set; }
        // 文件大小
        public string fileSize { get; set; }
        // 文件下载路径
        public string filePath { get; set; }

        /// <summary>
        /// 计算文件大小
        /// </summary>
        /// <param name="size"></param>
        /// <returns></returns>
        public void calculateSize(decimal size)
        {
            if (size == 0)
                fileSize = "0";
            decimal temp = size / 1024;
            if (temp >= 1024)
            {
                fileSize = Math.Round(temp / 1024, 2) + "M";
            }
            else
            {
                fileSize = Math.Round(temp, 2) + "K";
            }
        }

    }
}